xlv.obj.slideBox={
	extend:function(){
	}, 
	implement:function(){
	},
	create:function(tag){
		var div=document.createElement((tag||'div'));
		div.setAttribute('xlvobject','xlv.obj.slideBox');
		return div;			
	},
	properties:{
	},
	method:{
		construct:function(){
			var v=this.$V,p=this.$P;
			v.toolBar=xlv.util.findChild(this,{id:'slidebox_toolbar'});
			if(!v.toolBar) {
				this.appendChild(v.toolBar=document.createElement('div'));
				v.toolBar.setAttribute('id','slidebox_toolbar');
				this.styleFor(v.toolBar,v.toolBar.id);
				v.back=xlv.util.findChild(v.toolBar,{id:'xlvid_back'},false,false);
				if(!v.back){
					v.toolBar.appendChild(v.back=document.createElement('div'));
					v.back.setAttribute('id','xlvid_back');
					v.back.appendChild(v.back_title=document.createElement('span'));
					v.back_title.setAttribute('id','xlvid_backtitle');
				}
				v.name=xlv.util.findChild(v.toolBar,{id:'xlvid_name'},false,false);
				if(!v.name){
					v.toolBar.appendChild(v.name=document.createElement('div'));
					v.name.setAttribute('id','xlvid_name');
					this.styleFor(v.name,v.name.id);
				}
			}
			if(!v.back)v.back=xlv.util.findChild(v.toolBar,{id:'xlvid_back'},false,false);
			if(!v.name)v.name=xlv.util.findChild(v.toolBar,{id:'xlvid_name'},false,false);
			//
			this.appendChild(v.viewport=document.createElement('div'));
			v.viewport.setAttribute('id','slidebox_viewport');
			this.styleFor(v.viewport,v.viewport.id);
			v.viewport.appendChild(v.canvas=document.createElement('div'));
			v.canvas.setAttribute('id','slidebox_canvas');
			this.styleFor(v.canvas,v.canvas.id);
		},
		initial:function(){
			Element.addClassName(this,'class_slideBox');
			var v=this.$V,p=this.$P,box;
			v.viewport=xlv.util.findChild(this,{id:'slidebox_viewport'},false,false);
			v.canvas=xlv.util.findChild(this,{id:'slidebox_canvas'},false,false);
			v.toolBar=xlv.util.findChild(this,{id:'slidebox_toolbar'},false,false);
			v.back=xlv.util.findChild(v.toolBar,{id:'xlvid_back'},false,false);
			v.back_title=xlv.util.findChild(v.toolBar,{id:'xlvid_backtitle'},false,false);
			v.name=xlv.util.findChild(v.toolBar,{id:'xlvid_name'},false,false);
			v.currentBox=null;
			this.addEventHandler('click','_click');
		},
		_click:function(event){
			var target=event.target;
			if(target.id=='xlvid_back'||target.id=='xlvid_backtitle'){
				event.stop();
				return this.back();
			}
		},
		styleFor:function(tag,id){
		},
		build:function(node){
			this._createBox(node);
		},
		boxForToolBar:function(box){
			if(box.pNode){
				var name=(box.pNode.getAttribute('name')||'&nbsp;');
				if(this.$V.name)xlv.util.setElementValue(this.$V.name,name);
				var prev=xlv.util.findPrevSibling(box,{id:'slidebox_box'});
				if(this.$V.back)this.$V.back.style.display=(prev)?'block':'none';
				if(prev && this.$V.back_title)	xlv.util.setElementValue(this.$V.back_title,prev.pNode.getAttribute('name'));
			}
		},
		back:function(){
			var box = xlv.util.findPrevSibling(this.$V.currentBox,{id:'slidebox_box'});
			if(box){
				if(!this._commitBox(this.$V.currentBox))return;
				this.$V.currentBox=box;
				this._refreshBox(box);
				this._slideToBox(box);
			}
		},
		_slideToBox:function(box){
			this.boxForToolBar(box);
			var option={element:this.$V.viewport,properties:{},duration:300};
			option.properties.scrollLeft=box.offsetLeft;
			xlv.util.styleEffect(option);
		},
		_commitBox:function(box){
			return this.commitBox(box);
		},
		commitBox:function(box){
			return true;
		},
		_refreshBox:function(box){
			this.refreshBox(box);
		},
		refreshBox:function(box){
		},
		_createBox:function(node){
			var v=this.$V,box;
			var box=(this.$V.currentBox)?xlv.util.findNextSibling(this.$V.currentBox,{id:'slidebox_box'}):null;
			if(!box){
				var befs = (this.$V.currentBox)?xlv.util.findPrevSibling(this.$V.currentBox,{id:'slidebox_box'}):null;
				var count=(!befs)?3:befs.length+3;
				var width=this.$V.viewport.clientWidth;
				var padding=0;
				if(Prototype.Browser.IE && width==0) width=this.$V.viewport.offsetWidth;
				if(this.$V.canvas.offsetWidth < count*width)this.$V.canvas.style.width=(count*width)+'px';
				v.canvas.appendChild(box=document.createElement('div'));
				box.style.width=(width-padding*2)+'px';
				box.setAttribute('id','slidebox_box');
				this.styleFor(box,box.id);
				box.style.minHeight='1px';
			}
			if(node)this.nodeForBox(node,box);
			if(this.$V.currentBox) this._commitBox(this.$V.currentBox);
			this.$V.currentBox=box;
			this._slideToBox(box);
			return box;
		},
		nodeForBox:function(node,box){
		}
	}
};
